;;; Jmacs is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; Jmacs is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with Jmacs.  If not, see <http://www.gnu.org/licenses/>.

;; This is my specific customization of Emacs
;; It loads in some specific emacs packages, and adds those as propogated
;; inputs to my emacs

;; I can add in all the optional dependencies of emacs
;; https://git.savannah.gnu.org/cgit/emacs.git/tree/INSTALL

;; change the default configure flags:
;; --with-cairo to enable cairo drawing
;; I can try using GCC to natively compile elisp!
;; http://akrl.sdf.org/gccemacs.html#orgdf63763
;; --with-nativecomp
;; there may be a nix package for this: https://github.com/NixOS/nixpkgs/issues/87400
;; https://toobnix.org/videos/watch/1f997b3c-00dc-4f7d-b2ce-74538c194fa7
;; it is being developed on a branch of the emacs tree!
;; http://git.savannah.gnu.org/cgit/emacs.git?h=feature%2Fnative-comp

(define-module (gnu packages jmacs)
  #:use-module (guix packages)
  #:use-module (gnu packages)
  #:use-module (gnu packages aspell)
  #:use-module (gnu packages base)
  #:use-module (gnu packages code)
  #:use-module (gnu packages gnome-xyz)
  #:use-module (guix build-system emacs)
  #:use-module (gnu packages finance)
  #:use-module (gnu packages gdb)
  #:use-module (gnu packages mail)
  #:use-module (gnu packages sqlite)
  #:use-module (guix download)  ;;so I can download the source code...
  #:use-module (guix git-download)
  #:use-module (gnu packages emacs)
  #:use-module (gnu packages emacs-xyz)
  #:use-module (gnu packages rust-apps)
  #:use-module ((guix licenses) #:prefix license:)
  )

;;(define-public emacs-aggressive-fill-paragraph
;;  (package
;;   (name "emacs-aggressive-fill-paragraph")
;;   (version "20180910.816")
;;   (source
;;    (origin
;;     (method url-fetch)
;;     (uri (string-append
;;           "https://melpa.org/packages/aggressive-fill-paragraph-"
;;           version
;;           ".el"))
;;     (sha256
;;      (base32
;;       "12fi9r1wfzv8iqyzrnh82lq6793i9gxq52hk54acxskax29kmn30"))))
;;   (build-system emacs-build-system)
;;   (propagated-inputs `(("emacs-dash" ,emacs-dash)))
;;   (home-page
;;    "https://github.com/davidshepherd7/aggressive-fill-paragraph-mode")
;;   (synopsis
;;    "A mode to automatically keep paragraphs filled")
;;   (description
;;    "An Emacs minor-mode for keeping paragraphs filled in both comments and prose.")
;;   (license #f)))

(define-public emacs-flycheck-color-mode-line
  (package
    (name "emacs-flycheck-color-mode-line")
    (version "20200528.416")
    (source
     (origin
       (method url-fetch)
       (uri (string-append
             "https://melpa.org/packages/flycheck-color-mode-line-"
             version
             ".el"))
       (sha256
        (base32 "1ky0kzsbpb2cxdvg7miv402qglmin0grdfdwlvvq5wz5pxy3zw84"))))
    (build-system emacs-build-system)
    (propagated-inputs
     `(("emacs-flycheck" ,emacs-flycheck) ("emacs-dash" ,emacs-dash)))
    (home-page "https://github.com/flycheck/flycheck-color-mode-line")
    (synopsis "Change mode line color with Flycheck status")
    (description
     "Colorize the mode line according to the Flycheck status.

This package provides the `flycheck-color-mode-line-mode' minor mode which
changes the color of the mode line according to the status of Flycheck syntax
checking.

To enable this mode in Flycheck, add it to `flycheck-mode-hook':

(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)

Thanks go to:
- Thomas Järvstrand (tjarvstrand) for the initial code from the excellent
  EDTS package
- Sebastian Wiesner (lunaryorn) for flycheck and his awesome support.
")
    (license #f)))

(define-public emacs-flycheck-pos-tip
  (package
   (name "emacs-flycheck-pos-tip")
   (version "20200516.1600")
   (source
    (origin
     (method url-fetch)
     (uri (string-append
           "https://melpa.org/packages/flycheck-pos-tip-"
           version
           ".el"))
     (sha256
      (base32
       "150sadz6myaw5p5r9xym07jqfrfgipks64av7wndzqkhax8qjmhr"))))
   (build-system emacs-build-system)
   (propagated-inputs
    `(("emacs-flycheck" ,emacs-flycheck)
      ("emacs-pos-tip" ,emacs-pos-tip)))
   (home-page
    "https://github.com/flycheck/flycheck-pos-tip")
   (synopsis
    "Display Flycheck errors in GUI tooltips")
   (description
    "Provide an error display function to show errors in a tooltip.

Setup

(with-eval-after-load 'flycheck
  (flycheck-pos-tip-mode))
")
   (license #f)))

(define-public emacs-helm-flx
  (package

   (name "emacs-helm-flx")
   (version "20180103.516")
   (source
    (origin
     (method url-fetch)
     (uri (string-append
           "https://melpa.org/packages/helm-flx-"
           version
           ".el"))
     (sha256
      (base32
       "0wi5xix1y5cq1v4bsz5rl6kg2axw03s5j9xad174p0mi1pqyh04x"))))
   (build-system emacs-build-system)
   (propagated-inputs
    `(("emacs-helm" ,emacs-helm)
      ("emacs-flx" ,emacs-flx)))
   (home-page
    "https://github.com/PythonNut/helm-flx")
   (synopsis "Sort helm candidates by flx score")
   (description
    "This package implements intelligent helm fuzzy sorting, provided by flx.")
   (license license:gpl3+)))

(define-public emacs-all-the-icons-gnus
  (package
   (name "emacs-all-the-icons-gnus")
   (version "20180511.654")
   (source
    (origin
     (method url-fetch)
     (uri (string-append
           "https://melpa.org/packages/all-the-icons-gnus-"
           version
           ".el"))
     (sha256
      (base32
       "1w86rmwfljr46di2i19q2jcqp5gdsvfjim005rvzrb4lwnj5dnzb"))))
   (build-system emacs-build-system)
   (propagated-inputs
    `(("emacs-dash" ,emacs-dash)
      ("emacs-all-the-icons" ,emacs-all-the-icons)))
   (home-page "unspecified")
   (synopsis "Shows icons for in Gnus")
   (description
    "To use this package, do

(require 'all-the-icons-gnus)
(all-the-icons-gnus-setup)")
   (license #f)))

(define-public emacs-evil-goggles
  (package
   (name "emacs-evil-goggles")
   (version "20181123.1946")
   (source
    (origin
     (method url-fetch)
     (uri (string-append
           "https://melpa.org/packages/evil-goggles-"
           version
           ".el"))
     (sha256
      (base32
       "0zrmflb6fs891dhnjqwgg3cl1rm27kdq00dbwh62vzf3kkji7mkp"))))
   (build-system emacs-build-system)
   (propagated-inputs `(("emacs-evil" ,emacs-evil)))
   (home-page
    "http://github.com/edkolev/evil-goggles")
   (synopsis "Add a visual hint to evil operations")
   (description
    "Add a visual hint to evil edit operations such as yank, delete,
paste, etc.")
   (license #f)))

(define-public emacs-fsm
  (package
   (name "emacs-fsm")
   (version "0.2.1")
   (source
    (origin
     (method url-fetch)
     (uri (string-append
           "https://elpa.gnu.org/packages/fsm-"
           version
           ".el"))
     (sha256
      (base32
       "1jyxyqdbfl8nv7c50q0sg3w5p7whp1sqgi7w921k5hfar4d11qqp"))))
   (build-system emacs-build-system)
   (home-page
    "http://elpa.gnu.org/packages/fsm.html")
   (synopsis "state machine library")
   (description
    "fsm.el is an exercise in metaprogramming inspired by gen_fsm of
Erlang/OTP.  It aims to make asynchronous programming in Emacs Lisp
easy and fun.  By \"asynchronous\" I mean that long-lasting tasks
don't interfer with normal editing.")
   (license license:gpl3+)))

(define-public emacs-jabber
  (package
  (name "emacs-jabber")
  (version "20180927.2325")
  (source
    (origin
      (method url-fetch)
      (uri (string-append "https://melpa.org/packages/jabber-" version ".tar"))
      (sha256
        (base32 "15s5yx0ak610yrmihn0jnr8bbygldyii9lxhhb5469j7rnxib9yx"))))
  (build-system emacs-build-system)
  (propagated-inputs `(("emacs-fsm" ,emacs-fsm) ("emacs-srv" ,emacs-srv)))
  (home-page "unspecified")
  (synopsis "A Jabber client for Emacs.")
  (description "No description available.")
  (license #f)))

(define-public emacs-srv
  (package
   (name "emacs-srv")
   (version "20180715.1959")
   (source
    (origin
     (method url-fetch)
     (uri (string-append "https://melpa.org/packages/srv-" version ".el"))
     (sha256
      (base32 "1byxkbkmz108ps1l8zp4ij7dljzrj74b1sscn084mqpwnrf48nx6"))))
   (build-system emacs-build-system)
   (home-page "https://github.com/legoscia/srv.el")
   (synopsis "perform SRV DNS requests")
   (description
    "This code implements RFC 2782 (SRV records).  It was originally
written for jabber.el <http://emacs-jabber.sf.net>, but is now a
separate package.

It is used to look up hostname and port for a service at a specific
domain.  There might be multiple results, and the caller is supposed
to attempt to connect to each hostname+port in turn.  For example,
to find the XMPP client service for the domain gmail.com:

(srv-lookup \"_xmpp-client._tcp.gmail.com\")
-> ((\"xmpp.l.google.com\" . 5222)
    (\"alt3.xmpp.l.google.com\" . 5222)
    (\"alt4.xmpp.l.google.com\" . 5222)
    (\"alt1.xmpp.l.google.com\" . 5222)
    (\"alt2.xmpp.l.google.com\" . 5222))
")
   (license #f)))

(define-public emacs-hexrgb
  (package
   (name "emacs-hexrgb")
   (version "20091114.1959")
   (source
    (origin
     (method git-fetch)
     (uri (git-reference
           (url "https://notabug.org/jbranso/hexrgb.el.git")
           (commit "2ca08804e2b8718df6207fd35647d26262e48e11")))
     (sha256
      (base32 "10siq0pi7fmqbr05yvfgn8f7xapkfjb3xian90mv1zmrp47ilmir"))))
   (build-system emacs-build-system)
   (home-page "https://notabug.org/jbranso/hexrgb.el")
   (synopsis "Functions to manipulate colors, including RGB hex strings for Emacs.")
   (description
    "Functions to manipulate colors, including RGB hex strings for Emacs.  It is used in jabber.el.")
  (license #f)))

;;(define-public my-emacs-ledger-mode
;;  (package
;;   (name "emacs-ledger-mode")
;;   (version "20200530.1710")
;;   (source
;;    (origin
;;     (method url-fetch)
;;     (uri (string-append
;;           "https://melpa.org/packages/ledger-mode-"
;;           version
;;           ".tar"))
;;     (sha256
;;      (base32
;;       "1843pa6fkf76v44nwignwwn1h48m01l5g5nmrx7rynmshi95nkj0"))))
;;   (build-system emacs-build-system)
;;   (home-page "unspecified")
;;   (synopsis
;;    "Helper code for use with the \"ledger\" command-line tool")
;;   (description
;;    "Most of the general ledger-mode code is here.
;;")
;;   (license #f)))

(define-public emacs-scss-mode
  (package
   (name "emacs-scss-mode")
   (version "20180123.1708")
   (source
    (origin
     (method url-fetch)
     (uri (string-append
           "https://melpa.org/packages/scss-mode-"
           version
           ".el"))
     (sha256
      (base32
       "15305g09kaw813yib6l1q0ihwqw3hpbm3zg1v5rmc5x2dvcc61bj"))))
   (build-system emacs-build-system)
   (home-page "https://github.com/antonj/scss-mode")
   (synopsis "Major mode for editing SCSS files")
   (description
    "Command line utility sass is required, see http://sass-lang.com/
To install sass:
gem install sass

Also make sure sass location is in emacs PATH, example:
(setq exec-path (cons (expand-file-name \"~/.gem/ruby/1.8/bin\") exec-path))
or customize `scss-sass-command' to point to your sass executable.
")
   (license #f)))

(define-public emacs-smart-comment
  (package
   (name "emacs-smart-comment")
   (version "20160322.1839")
   (source
    (origin
     (method url-fetch)
     (uri (string-append
           "https://melpa.org/packages/smart-comment-"
           version
           ".el"))
     (sha256
      (base32
       "03cqfwk7nxl0bj1cj1kv3hrd0811w82q0lccqxl9l8iqlx5m27yz"))))
   (build-system emacs-build-system)
   (home-page "unspecified")
   (synopsis "smarter commenting")
   (description
    "Code gets rewritten when refactoring to accomidate for new features or
when fixing bugs. An approach used by many developers is to disable a
piece of code with comments, then rewrite an improved version below,
test that is works and then delete the commented code. smart-comment
makes this and similair workflows much swifter.

smart-comment is implemented on top of the commenting functions built
in to Emacs. It is meant to replace `comment-dwim` as the function you
bind to `M-;`.

It triggers different comment actions taking the current location of
the point into acount. Commenting out lines of code is faster.
Commented lines can be marked for later deletion and then all removed
with a single command.
")
   (license #f)))


(define-public emacs-vala-mode
  (package
    (name "emacs-vala-mode")
    (version "20201218.2109")
    (source
     (origin
       (method url-fetch)
       (uri (string-append
             "https://melpa.org/packages/vala-mode-"
             version
             ".el"))
       (sha256
        (base32
         "0y0j4mxiwddyyrmglfyyilaivchgj6v2x8w5qz0ik7c2xr84apnp"))))
    (build-system emacs-build-system)
    (home-page "unspecified")
    (synopsis "Vala mode derived mode")
    (description
     "
   See http://live.gnome.org/Vala for details about Vala language.

   This mode was based on Dylan Moonfire's csharp-mode.

This is a copy of the function in cc-mode which is used to handle
the eval-when-compile which is needed during other times.
")
    (license #f)))


(define-public jmacs
  (package
   (inherit emacs)
   (name "jmacs")
   ;; (inputs
   ;;  `(("gnu-make"                        ,gnu-make)))
   (propagated-inputs  ;;installed in the store and present in the profile
    `(("aspell"                          ,aspell)
      ("aspell-dict-en"                  ,aspell-dict-en)
      ("emacs-2048-game"                 ,emacs-2048-game)
      ("emacs-async"                     ,emacs-async)
      ("emacs-anzu"                      ,emacs-anzu)
      ("emacs-all-the-icons"             ,emacs-all-the-icons)
      ("emacs-all-the-icons-dired"       ,emacs-all-the-icons-dired)
      ("emacs-all-the-icons-gnus"        ,emacs-all-the-icons-gnus)
      ("emacs-alert"                     ,emacs-alert)
      ;; ("emacs-aggressive-fill-paragraph" ,emacs-aggressive-fill-paragraph)
      ("emacs-aggressive-indent"         ,emacs-aggressive-indent)
      ("emacs-ag"                        ,emacs-ag)
      ("emacs-ace-window"                ,emacs-ace-window)
      ("emacs-avy"                       ,emacs-avy)
      ;;       ("emacs-bug-hunter"                ,emacs-bug-hunter)
      ("emacs-build-farm"                ,emacs-build-farm)
      ("emacs-bbdb"                      ,emacs-bbdb)
      ("emacs-company"                   ,emacs-company)
      ("emacs-daemons"                   ,emacs-daemons)
      ;; ;; list library
      ("emacs-dash"                      ,emacs-dash)
      ;;("emacs-dashboard"               ,emacs-dashboard)
      ;; ;; show the diffs in a git buffer on the fringe of a buffer.
      ("emacs-diff-hl"                   ,emacs-diff-hl)
      ("emacs-dumb-jump"                 ,emacs-dumb-jump)
      ("emacs-ebdb"                      ,emacs-ebdb)
      ("emacs-company-ebdb"              ,emacs-company-ebdb)
      ("emacs-elfeed"                    ,emacs-elfeed)
      ("emacs-emmet-mode"                ,emacs-emmet-mode)
      ;;("emacs-emms"                      ,emacs-emms)
      ("emacs-evil"                      ,emacs-evil)
      ("emacs-evil-args"                 ,emacs-evil-args)
      ("emacs-evil-commentary"           ,emacs-evil-commentary)
      ("emacs-evil-goggles"              ,emacs-evil-goggles)
      ("emacs-evil-surround"             ,emacs-evil-surround)
      ;; this lets you use the debian pastebin!!!
      ("emacs-debpaste"                  ,emacs-debpaste)
      ("emacs-debbugs"                   ,emacs-debbugs)
      ("emacs-f"                         ,emacs-f)
      ("emacs-f3"                        ,emacs-f3)
      ("emacs-fish-completion"           ,emacs-fish-completion)
      ("emacs-flycheck"                  ,emacs-flycheck)
      ("emacs-flycheck-pos-tip"          ,emacs-flycheck-pos-tip)
      ("emacs-flycheck-color-mode-line"  ,emacs-flycheck-color-mode-line)
      ("emacs-flycheck-guile"            ,emacs-flycheck-guile)
      ("emacs-flx"                       ,emacs-flx)
      ("emacs-geiser"                    ,emacs-geiser)
      ("emacs-geiser-guile"              ,emacs-geiser-guile)
      ("emacs-gif-screencast"            ,emacs-gif-screencast)
      ("emacs-git-timemachine"           ,emacs-git-timemachine)
      ("emacs-gitpatch"                  ,emacs-gitpatch)
      ("emacs-ggtags"                    ,emacs-ggtags)
      ("emacs-gnuplot"                   ,emacs-gnuplot)
      ("emacs-gnus-harvest"              ,emacs-gnus-harvest)
      ("emacs-gtk-look"                  ,emacs-gtk-look)
      ;;("emacs-guix"                      ,emacs-guix)
      ("emacs-helm"                      ,emacs-helm)
      ;;("emacs-helm-flx"                  ,emacs-helm-flx)
      ("emacs-helm-ag"                   ,emacs-helm-ag)
      ("emacs-helm-gtags"                ,emacs-helm-gtags)
      ("emacs-helm-mu"                   ,emacs-helm-mu)
      ("emacs-helm-projectile"           ,emacs-helm-projectile)
      ("emacs-helm-swoop"                ,emacs-helm-swoop)
      ("emacs-helm-system-packages"      ,emacs-helm-system-packages)
      ("emacs-hl-todo"                   ,emacs-hl-todo)
      ("emacs-json-mode"                 ,emacs-json-mode)
      ("emacs-jabber"                    ,emacs-jabber)
      ("emacs-hexrgb"                    ,emacs-hexrgb)
      ("emacs-js2-mode"                  ,emacs-js2-mode)
      ;;("my-emacs-ledger-mode"            ,my-emacs-ledger-mode)
      ;; emacs vala-mode is apparently NOT compiling now
      ;; https://github.com/rrthomas/vala-mode/tree/d696a8177e94c81ea557ad364a3b3dcc3abbc50f
;;       In toplevel form:
;; vala-mode.el:270:8:Warning: reference to free variable
;;     ‘vala-multiline-strings’
;; Eval error in the ‘c-lang-defconst’ for ‘c-multiline-string-start-char’ in vala-mode:
;; Symbol’s value as variable is void: vala-multiline-strings
;; command "/gnu/store/6kfvm6qhm5g875jp34x84bgiffhwbyn9-emacs-minimal-27.2/bin/emacs" "--quick" "--batch" "--eval=(eval '(progn (setq byte-compile-debug t) (byte-recompile-directory (file-name-as-directory \"/gnu/store/s8dhwn4q70yl8dwcg29v7n5hmzc9m24v-emacs-vala-mode-20201218.2109/share/emacs/site-lisp/vala-mode-20201218.2109\") 0 1)) t)" failed with status 255

      ;; I could try this vala mode https://www.emacswiki.org/emacs/vala-mode.el

      ;; this vala mode works
      ;; https://wiki.gnome.org/Projects/Vala/Emacs  this works
      ;; this youtube guide shows you how to learn
      ;; vala https://www.youtube.com/watch?v=0R8gzwiR9sI&list=PLriKzYyLb28mn2lS3c5yqMHgLREi7kR9-&index=5


      ;; ("emacs-vala-mode"                 ,emacs-vala-mode)
      ;; ("emacs-lsp-mode"                  ,emacs-lsp-mode)
      ;; ("vala-language-server"            ,vala-language-server)
      ("emacs-lua-mode"                  ,emacs-lua-mode)
      ("emacs-magit"                     ,emacs-magit)
      ("emacs-magit-popup"               ,emacs-magit-popup)
      ("emacs-magit-todos"               ,emacs-magit-todos)
      ("emacs-magit-org-todos-el"        ,emacs-magit-org-todos-el)
      ("emacs-mbsync"                    ,emacs-mbsync)
      ("emacs-markdown-mode"             ,emacs-markdown-mode)
      ("emacs-mu4e-alert"                ,emacs-mu4e-alert)
      ("emacs-nov-el"                    ,emacs-nov-el)
      ("emacs-nginx-mode"                ,emacs-nginx-mode)
      ("emacs-org"                       ,emacs-org)
      ("emacs-org-bullets"               ,emacs-org-bullets)
      ("emacs-org-contrib"               ,emacs-org-contrib)
      ("emacs-pdf-tools"                 ,emacs-pdf-tools)
      ("emacs-page-break-lines"          ,emacs-page-break-lines)
      ;; todo make this emacs-parinfer-mode@0.4.10
      ("emacs-paredit"                   ,emacs-paredit)
      ("emacs-parinfer-mode"             ,emacs-parinfer-mode)
      ("emacs-projectile"                ,emacs-projectile)
      ;; ;; display CSS #000000 as black
      ("emacs-rainbow-mode"              ,emacs-rainbow-mode)
      ("emacs-s"                         ,emacs-s)
      ;;("emacs-smart-mode-line"         ,emacs-smart-mode-line)
      ("emacs-scss-mode"                 ,emacs-scss-mode)
      ("emacs-smart-comment"             ,emacs-smart-comment)
      ("emacs-smartparens"               ,emacs-smartparens)
      ("emacs-transmission"              ,emacs-transmission)
      ("emacs-which-key"                 ,emacs-which-key)
      ;;("emacs-wget"                      ,emacs-wget)
      ("emacs-web-mode"                  ,emacs-web-mode)
      ("emacs-use-package"               ,emacs-use-package)
      ("emacs-yasnippet"                 ,emacs-yasnippet)
      ("emacs-yasnippet-snippets"        ,emacs-yasnippet-snippets)
      ("emacs-youtube-dl"                ,emacs-youtube-dl)
      ("emacs-zenurnburn-theme"          ,emacs-zenburn-theme)
      ("gdb"                             ,gdb)
      ("ledger"                          ,ledger)
      ;;("notmuch"                         ,notmuch)
      ("ripgrep"                         ,ripgrep)
      ("emacs-rg"                        ,emacs-rg)
      ("emacs-deadgrep"                  ,emacs-deadgrep)
      ("the-silver-searcher"             ,the-silver-searcher)
      ("sqlite"                          ,sqlite)))))

;; uncomment this to make this work via install file
;; jmacs


;; maybe I should use this one day
;; "emacs-znc"
;; https://github.com/sshirokov/ZNC.el
;; znc
